package com.example.demo.service.serviceimpl;

import com.example.demo.dao.HistoryDao;
import com.example.demo.entity.HistoryEntity;
import com.example.demo.service.HistoryService;
import com.example.demo.vo.HistoryVo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HistoryServiceImpl implements HistoryService {
    @Resource
    HistoryDao historyDao;

    @Override
    public List<HistoryEntity> getUserHistory(int user_id) {
        return historyDao.getHistoryByUserId(user_id);
    }

    @Override
    public int addHistory(HistoryVo historyVo) {
        return historyDao.addHistory(historyVo);
    }

    @Override
    public int deleteHistory(int id) {
        return historyDao.delHistory(id);
    }

    @Override
    public int deleteHistoryByUserAndProduct(int user_id, int products_id) {
        return historyDao.delHistoryByUserAndProduct(user_id, products_id);
    }

    @Override
    public HistoryEntity getHistoryById(int id) {
        return historyDao.getHistoryById(id);
    }

    @Override
    public int updateHistory(HistoryVo historyVo) {
        return historyDao.updateHistory(historyVo);
    }
}